#include<stdio.h>

int main(void)
{
	int sum=0;
	int t;
	while(scanf("%d",&t),t)
	{
		if(t<0)
			sum=sum+t;
	}
	printf("%d\n",sum);
	return 0;
}
